

package com.dog.basics.sys.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dog.basics.bean.dto.admin.sys.AdminSysLogFromDto;
import com.dog.basics.bean.vo.admin.sys.AdminSysLogVo;
import com.dog.basics.common.util.PageParam;
import com.dog.basics.common.util.R;
import com.dog.basics.service.sys.SysLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 日志表 前端控制器
 * </p>
 *
 * @author guonh
 * @since 2017-11-20
 */
@RestController
@AllArgsConstructor
@RequestMapping("/admin/log")
@Api(value = "日志管理模块", tags = "日志管理模块")
public class SysLogController {

    private final SysLogService sysLogService;
    /**
     * 系统日志列表
     */
    @GetMapping("/page")
    @ApiOperation(value = "系统日志列表", notes = "sys_log_page")
   @PreAuthorize("@pms.hasPermission('sys_log_page')")
    public R<IPage<AdminSysLogVo>> page(PageParam page, AdminSysLogFromDto obj){
        return R.ok(sysLogService.getPageList(page,obj));
    }
    /**
     * 删除日志
     * @param id ID
     * @return success/false
     */
    @DeleteMapping("/{id}")
    @ApiOperation(value = "删除日志", notes = "sys_log_del")
    @PreAuthorize("@pms.hasPermission('sys_log_del')")
    public R removeById(@PathVariable Long id) {
        return R.ok(sysLogService.removeById(id));
    }
}
